<?php namespace Member\Model;

use Hdphp\Model\Model;

class Balance extends Model{

//数据表
	protected $table = "shop_order";




	public function shopCar()
	{


		$intocar=array();

		$permission = 0;
		$_GET['buynum'] = isset($_GET['buynum'])?$_GET['buynum']:1;
		$_SESSION['shopcar'] = isset($_SESSION['shopcar'])?$_SESSION['shopcar']:array();
		foreach ($_SESSION['shopcar'] as $k => $v) {

			if ($v['mix_id']==$_GET['data']) {

				$_SESSION['shopcar'][$k]['buynum']=$_SESSION['shopcar'][$k]['buynum']+$_GET['buynum'];
				$_SESSION['shopcar'][$k]['create_at']=time();

				$permission = 1;

				break;
			}
			else
			{
				continue;
			}
		}


		if ($permission == 0) {
			$intocar['goods_id']=$_GET['good_id'];
			$intocar['mix_id']=$_GET['data'];
			$intocar['buynum']=$_GET['buynum'];
			$intocar['create_at']=time();
			$_GET['buynum']=0;
			$_SESSION['shopcar'][] = $intocar;

		}
		return true;

	}

}